<?php

use yii\db\Migration;

class m180606_062401_alter_customer_relationship extends Migration
{
    private function createDbs()
    {
        $dbs = [];
        $dbs_info = \Yii::$app->params['db'];
        foreach ($dbs_info as $k => $v) {
            $dbs[$k] = \Yii::createObject($v);
        }
        return $dbs;
    }

    public function safeUp()
    {
        $dbs = $this->createDbs();
        foreach ($dbs as $v) {
            $this->db = $v;
            $this->addColumn('{{%customer_relationship}}', 'customer_id', $this->integer(11)->defaultValue(0)->comment('用户id'));

        }

    }

    public function safeDown()
    {
        $dbs = $this->createDbs();
        foreach ($dbs as $v) {
            $this->db = $v;
            $this->dropColumn('{{%customer_relationship}}', 'customer_id');

        }
    }
}
